Ext.define('AmpleHarvest.objects.contentHighlight.cToolbar',
{
	extend				: 'Ext.toolbar.Toolbar',
	alias				: 'widget.ampleharvest-objects-contenthighlight-ctoolbar',
	requires			:
	[
			'Ext.data.TreeStore', 'Ext.button.Button'
	],
	bubbleEvents		:
		[
			'highlight'
		],
	initComponent		: function()
	{
		var obj_This = this;

		this.m_obj_Highlight_all = Ext.create("Ext.button.Button",
		{
			text		: 'Highlight All',
			iconCls		: "toolbar-article-navigation-files-view",
			handler		: function(rowIndex)
			{
				var store = this.up('widget.ampleharvest-objects-contenthighlight-chighlight').getStore();
							
				store.each(function(record){
					
					record.set('hl_status',true);
					
					var hl_id = record.get('hl_id');
					var hl_class = '';
					var hl_attribute = 'entity_id';
					
					if(record.get('hl_status'))
					{	
						hl_class = record.get('hl_class');
					}
					obj_This.fireEvent('highlight', hl_id, hl_class, hl_attribute);
				});
			}
		}
		);
		
		this.m_obj_Highlight_none = Ext.create("Ext.button.Button",
				{
					text		: 'Highlight None',
					iconCls		: "toolbar-article-navigation-files-view",
					handler		: function(rowIndex)
					{
						var store = this.up('highlightWindow').getStore();
									
						store.each(function(record){
							
							record.set('hl_status',false);
							
							var hl_id = record.get('hl_id');
							var hl_class = '';
							var hl_attribute = 'entity_id';
							
							if(record.get('hl_status'))
							{	
								hl_class = record.get('hl_class');
							}
							obj_This.fireEvent('highlight', hl_id, hl_class, hl_attribute);
						});
					}
				}
				);


		this.callParent();

		this.add(this.m_obj_Highlight_all);
		this.add(this.m_obj_Highlight_none);
	}
}
);